package demo;
import java.util.concurrent.ThreadFactory;

class YootkThreadFactory implements ThreadFactory {
    private static final ThreadFactory THREAD_FACTORY;
    private static final String TITLE = "yootk-";
    private static int count = 0;

    static {
        THREAD_FACTORY = new YootkThreadFactory();
    }

    public static ThreadFactory getInstance() {
        return THREAD_FACTORY;
    }

    @Override
    public Thread newThread(Runnable run) {
        return new Thread(run, TITLE + count++);
    }
}

public class YootkDemop235 {
    public static void main(String[] args) throws Exception {
        Thread thread = YootkThreadFactory.getInstance().newThread(() -> {
            System.out.println("多线程执行，" + Thread.currentThread().getName());
        });
        thread.start();
    }
}
